{% extends 'topic/master.html' %}
{% block main %}
    <div class="box">
        <div class="inner" style="background-color: #fff; border-top-left-radius: 3px; border-top-right-radius: 3px;" id="Tabs">
            {% for obj in category_obj %}
                {% if current_tab == obj.code %}
                    <a class="btn btn-sm btn-secondary" href="{% url 'index' %}?tab={{ obj.code }}">{{ obj.name }}</a>
                {% else %}
                    <a class="btn btn-sm btn-light" href="{% url 'index' %}?tab={{ obj.code }}">{{ obj.name }}</a>
                {% endif %}
            {% endfor %}
        </div>
        {% if not category_obj.hot %}
            <div class="cell" style="background-color: #f9f9f9; padding: 10px 10px 10px 20px;">
                {% for obj in category_children_obj %}
                    <a href="{% url 'node' obj.code %}" class="badge badge-dark">{{ obj.name }}</a>
                {% endfor %}
            </div>
        {% endif %}
        {% for obj in topic_obj %}
            <div class="cell item">
                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                    <tbody>
                    <tr>
                        <td width="48" valign="top" align="center">
                            <a href="{% url 'member' obj.author.username %}">
                                <img src="{{ obj.author.avatar }}" class="rounded" alt="{{ obj.author.username }}"
                                     width="48px" height="48px" border="0" align="default">
                            </a>
                        </td>
                        <td width="10"></td>
                        <td width="auto" valign="middle">
                            <span class="item_title"><a href="{% url 'topic' obj.topic_sn %}">{{ obj.title|safe }}</a></span>
                            <div class="sep5"></div>
                            <span class="small">
                            <div class="votes"></div>
                            <a class="node" href="{% url 'node' obj.category.code %}">{{ obj.category.name }}</a> &nbsp;•&nbsp;
                            <strong>
                                <a href="{% url 'member' obj.author.username %}">{{ obj.author.username }}</a>
                            </strong>
                            {% if obj.last_comment_user %}
                                &nbsp;•&nbsp; {{ obj.last_comment_time }} &nbsp;•&nbsp; 最后回复来自
                                <strong>
                                    <a href="{% url 'member' obj.last_comment_user %}">{{ obj.last_comment_user }}</a>
                                </strong>
                            {% endif %}
                        </span>
                        </td>
                        <td width="70" align="right" valign="middle">
                            <a href="{% url 'topic' obj.topic_sn %}"
                               class="read_status badge badge-pill badge-secondary">&nbsp;{{ obj.comment_num }}&nbsp;</a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        {% endfor %}
        <div class="inner">
            <span class="chevron">→</span> <a href="{% url 'recent' %}">更多新主题</a>
        </div>
    </div>
{% endblock %}
